<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddSetsToSysDeptTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('sys_dept', function (Blueprint $table) {
            $table->unsignedInteger(\Kalnoy\Nestedset\NestedSet::LFT)->default(0);
            $table->unsignedInteger(\Kalnoy\Nestedset\NestedSet::RGT)->default(0);
//            $table->unsignedInteger(\Kalnoy\Nestedset\NestedSet::PARENT_ID)->nullable();
            $table->index(\Kalnoy\Nestedset\NestedSet::getDefaultColumns());

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('sys_dept', function (Blueprint $table) {
            //
            $table->dropColumn(\Kalnoy\Nestedset\NestedSet::LFT);
            $table->dropColumn(\Kalnoy\Nestedset\NestedSet::RGT);

        });
    }
}
